/**
 * Created by dashan on 2017/3/27.
 */
var mongoose = require('mongoose');

mongoose.Promise = Promise;

mongoose.connect('mongodb://dev1.bjvca.com:27017/test2');

var UserSchema = new  mongoose.Schema({
    nickname:{
        type:String,
        default:'new user'
    },
    regTime:{
        type:Date,
        default:Date.now
    }
});


//  Schema#add(obj, prefix)
// UserSchema.add({age:'string'})


// UserSchema.eachPath(function(parm1,parm2){
//     console.log(parm1);
//     console.log("--------------------");
//     console.log(parm2);
// })

// console.log(UserSchema.path('nickname',Number).path('nickname'));

console.log(UserSchema.pathType("nickname"));;

var User = mongoose.model('User',UserSchema);
var user = new User({nickname:'doudou',age:'10'});







// user.save(function(err,doc){
//    console.log(err);
//     console.log(doc);
// });